<?php
/**
 * This file is part of Notadd.
 *
 * @author        Hollydan <2642956839@qq.com>
 * @copyright (c) 2017, notadd.com
 * @datetime      17-11-20 下午5:52
 */

namespace Notadd\Seckill\GraphQL\Type;


use GraphQL\Type\Definition\Type;
use Notadd\Foundation\GraphQL\Abstracts\Type as AbstractsType;

class TimeType extends  AbstractsType
{

    /**
     * @return array
     */
    public function fields()
    {
        return [
            'code' => [
                'type' => Type::int(),
                'description' => '返回码',
            ],
            'data' => [
                'id' => [
                    'type' => Type::int(),
                ],
                'name' => [
                    'type' => Type::string(),
                    'description' => '时间段名称',
                ],
                'time_start' => [
                    'type' => Type::string(),
                    'description' => '开始时间',
                ],
                'time_end' => [
                    'type' => Type::string(),
                    'description' => '结束时间',
                ],
            ],
            'pagination' => [
                'total' => [
                    'type' => Type::int(),
                ],
                'per_page' => [
                    'type' => Type::int(),
                ],
                'current_page' => [
                    'type' => Type::int(),
                ],
                'last_page' => [
                    'type' => Type::int(),
                ],
                'next_page_url' => [
                    'type' => Type::string(),
                ],
                'prev_page_url' => [
                    'type' => Type::string(),
                ],
                'from' => [
                    'type' => Type::int(),
                ],
                'to' => [
                    'type' => Type::int(),
                ],
            ],
            'message' => [
                'type' => Type::string(),
                'description' => '返回的状态信息',
            ],
        ];
    }

    /**
     * @return string
     */
    public function name()
    {
        return 'Time';
    }
}